package com.solt.prism.core;

import java.net.URL;

import org.w3c.dom.Document;

import com.solt.prism.core.wrapper.LocalHtmlRendererContext;
import com.solt.prism.core.wrapper.LocalUserAgentContext;

public class PageFetcher {
	private LocalHtmlRendererContext rcontext;
	
	public PageFetcher() {
		LocalUserAgentContext uacontext = new LocalUserAgentContext();
		rcontext = new LocalHtmlRendererContext(uacontext);
	}

	public Document retrieve(String url) {
		if (url == null) {
			return null;
		}
		rcontext.navigate(url);
		return rcontext.getCurrentDocument();
	}

	public Document retrieve(URL url) {
		if (url == null) {
			return null;
		}
		rcontext.navigate(url);
		return rcontext.getCurrentDocument();
	}

}